//
//  SGLevelScene.m
//  EatNumber
//
//  Created by zg.shao on 14/12/19.
//  Copyright (c) 2014年 kuwo.cn. All rights reserved.
//

#import "SGLevelScene.h"

@interface SGLevelScene () {
    NSMutableArray *_levelBtnItems; //
    
    SKLabelNode *_menuItem1;
    SKLabelNode *_menuItem2;
}

@end


@implementation SGLevelScene

- (id) initWithSize:(CGSize)size {
    if(self = [super initWithSize:size]) {
        // here you create your labels
        _menuItem1 = [SKLabelNode labelNodeWithText:@"Menu 1"];
        
        // this will position this at the center, top 1/3 of the screen
        _menuItem1.position = CGPointMake(self.frame.size.width/2, self.frame.size.height * .3);
        [self addChild:_menuItem1]; // takes care of the first
        
        _menuItem2 = [SKLabelNode labelNodeWithText:@"Menu 2"];
        
        // place at center, lower 1/3 of screen
        _menuItem2.position = CGPointMake(self.frame.size.width/2, self.frame.size.height * .6);
        [self addChild:_menuItem2];
    }
    return self;
}

- (void)didMoveToView:(SKView *)view {

}

- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *t = [touches anyObject];
    CGPoint touchLocation = [t locationInNode:self.scene];
    
    if(CGRectContainsPoint(_menuItem1.frame, touchLocation)) {
        // do whatever for first menu
    }
    
    if(CGRectContainsPoint(_menuItem2.frame, touchLocation)) {
        // do whatever for second menu
    }
}

@end
